unit uPro_inq;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, rpcompobase, rpvclreport, dxCore, dxButton, ExtCtrls, StdCtrls,
  Buttons, XPMenu;

type
  TfPro_inq = class(TForm)
    SpeedButton1: TSpeedButton;
    Label3: TLabel;
    Edit1: TEdit;
    edCodCliente: TEdit;
    Panel2: TPanel;
    dxButton1: TdxButton;
    dxButton2: TdxButton;
    Panel1: TPanel;
    Label2: TLabel;
    Label1: TLabel;
    VCLReport1: TVCLReport;
    XPMenu1: TXPMenu;
    procedure SpeedButton1Click(Sender: TObject);
    procedure dxButton1Click(Sender: TObject);
    procedure dxButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fPro_inq: TfPro_inq;

implementation

uses uProcurar, UDM;

{$R *.dfm}

procedure TfPro_inq.SpeedButton1Click(Sender: TObject);
begin
  FProcurar:=TFProcurar.Create(Self,dm.proc_proprietario);
  try
   FProcurar.BtnProcurar.Click;
   fProcurar.EvDBFind1.DataField := 'NOME_PROPRIETARIO';
   if FProcurar.ShowModal=mrOK then
  begin
   edCodCliente.Text := dm.proc_proprietarioNOME_PROPRIETARIO.AsString;
   Edit1.Text := IntToStr(dm.proc_proprietarioCOD_PROPRIETARIO.AsInteger);
  end;
  finally
   DM.proc_proprietario.Close;
   FProcurar.Free;
  end;

end;

procedure TfPro_inq.dxButton1Click(Sender: TObject);
begin

  VCLReport1.Filename := str_relatorio + 'Prop_Inq.rep';
  if edCodCliente.Text = '' then
  begin
    VCLReport1.Report.Params.ParamByName('CODIGO').Value := 9999999;
    VCLReport1.Title := VCLReport1.FileName;
    VCLReport1.Execute;
  end
  else
  begin
    VCLReport1.Report.Params.ParamByName('CODIGO').Value :=  StrToInt(Edit1.Text);
    VCLReport1.Title := VCLReport1.FileName;
    VCLReport1.Execute;
  end;
end;

procedure TfPro_inq.dxButton2Click(Sender: TObject);
begin
 close;
end;

end.
